package com.zh.streamdemo.demo1;

import java.util.*;
import java.util.stream.Stream;

public class DemoDistinct {
    public static void main(String[] args) {
        Stream.of("地瓜", "土豆", "茄子","白菜","土豆","茄子","黄瓜").distinct().forEach(System.out::println);
        Stream.of(2, 3, 2,4,7,9,7).distinct().forEach(System.out::println);

        Random r = new Random();
        List<Map<String, Object>> lm = new ArrayList<>();
        for (int i = 1;i < 9;i++){
            Map<String, Object> m = new HashMap<>();
            m.put("date","2022-12-0"+r.nextInt(9));
            lm.add(m);
            System.out.println(m);
        }
        System.out.println("---------------------");
        lm.stream().distinct().forEach(System.out::println);
    }
}
